


//
//  ZYPeopleOneCell.m
//  优学荟管理系统
//
//  Created by edz on 2018/1/5.
//  Copyright © 2018年 星道三好. All rights reserved.
//

#import "ZYPeopleOneCell.h"
#import "ZYPeopleOneModel.h"
@implementation ZYPeopleOneCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setUpSuperView];
    }
    
    
    
    return self;
    
}


- (void)assignByZYPeopleOneModel:(ZYPeopleOneModel *)model{
    
    self.nameLabel.text = [NSString stringWithFormat:@"%@",model.name];
    self.timeLabel.text = [NSString stringWithFormat:@"上课老师：%@",model.petname];
    
    self.circleProgressView.percent = [model.percent floatValue];
    
    float mm = [model.percent floatValue] * 100;
    self.circleProgressView.centerLabel.text = [NSString stringWithFormat:@"%.f%@",mm,@"%"];
    
    
    
}







- (void)setUpSuperView{
    
    
    self.nameLabel = [UILabel new];
    self.nameLabel.font = [UIFont systemFontOfSize:16];
    self.nameLabel.textColor = ColorRGB(51, 51, 51);
    [self.contentView addSubview:self.nameLabel];
    
    
    self.couseLabel = [UILabel new];
    self.couseLabel.font = [UIFont systemFontOfSize:14];
    self.couseLabel.textColor = ColorRGB(102,102,102);
    self.couseLabel.numberOfLines = 0;
    [self.contentView addSubview:self.couseLabel];
    
    self.timeLabel = [UILabel new];
    self.timeLabel.font = [UIFont systemFontOfSize:12];
    self.timeLabel.textColor = ColorRGB(102,102,102);
    [self.contentView addSubview:self.timeLabel];
    
    
    
    
    
    self.circleProgressView = [[CircleProgressView alloc]initWithFrame:CGRectMake(kScreenWidth - (kScreenWidth *86/750 + kScreenWidth *30/750) - 10 , kScreenHeight *60/1334, kScreenWidth *86/750, kScreenWidth *86/750)];
    
    
    self.circleProgressView.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.circleProgressView];
    
    self.nameLabel.text = @"北京上海";
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kScreenWidth *33/750);
        make.top.offset(kScreenHeight *30/1334);
        make.right.equalTo(self).offset(-kScreenWidth *86/750);
    }];
    
    
    
    [self.couseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel);
        make.right.equalTo(self).offset(-kScreenWidth *86/750);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(0);
    }];
    
    
    [self.circleProgressView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-kScreenWidth *30/750);
        make.centerY.equalTo(self.couseLabel);
        make.width.height.offset(kScreenWidth *86/750);
    }];
    
    
    UILabel *label = [UILabel new];
    label.font = [UIFont systemFontOfSize:11];
    label.textColor = ColorRGB(102,102,102);
    label.textAlignment = NSTextAlignmentCenter;
    label.text = @"到课率";
    [self.contentView addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-kScreenWidth *30/750);
        make.top.equalTo(self.circleProgressView.mas_bottom).offset(3);
        make.width.equalTo(self.circleProgressView);
    }];
    
    
    self.timeLabel.text = @"布置时间：2012.3.11";
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.couseLabel);
        make.top.equalTo(self.couseLabel.mas_bottom).offset(kScreenHeight *30/1334);
    }];
    
    
    
    
    
    
    
    
    UILabel *lineLabel = [UILabel new];
    lineLabel.backgroundColor = ColorRGB(247, 245, 245);
    [self.contentView addSubview:lineLabel];
    
    
    [lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.top.equalTo(self.timeLabel.mas_bottom).offset(16);
        make.width.offset(kScreenWidth);
        make.height.offset(kScreenHeight *30/1334);
    }];
    
    
    [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
        make.bottom.mas_equalTo(lineLabel).offset(0);
    }];
    
    
}


@end
